import * as Quasar from 'quasar'
import PresetDialog from '../components/PresetDialog/index.vue'
/**
 * 操作确认，promise版
 * @param title
 */
export function waitConfirm(title = '') {
  return new Promise((resolve,reject) => {
    Quasar.Dialog.create({
      message: title,
      cancel: true,
      persistent: true
    }).onOk(resolve).onCancel(() => reject())
  })
}

/**
 * 打开弹窗
 */
export function openDialog(props = {}) {
  return Quasar.Dialog.create({
    component: PresetDialog,
    // 转发到自定义组件的 props
    componentProps: props
  })
}
